package com.example.siyun.controller.shouyecontroller;

import com.example.siyun.pojo.Dhl;
import com.example.siyun.service.impl.shouyeserviceimpl.DhServiceImpl;
import com.example.siyun.util.PageResult;
import com.example.siyun.util.WebUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @Auther: 全
 * @Date: 2022/9/26 09:33
 * @Description:导航栏
 */
@Slf4j
@RestController
public class DhController {
    @Autowired
    private DhServiceImpl dhService;
    @RequestMapping("/username")
    public PageResult username(){
        String username = (String) WebUtils.getSession().getAttribute("usernamename");
        System.out.println(username);
        PageResult pageResult=new PageResult();
        pageResult.setMessage("成功");
        pageResult.setData(username);
        return pageResult;
    }
    /**
     * 获取导航栏的数据
     * @return 返回导航栏的数据
     */
    @RequestMapping("/aa")
    public List<Dhl> findMenu(){
        log.info("获取导航栏的数据");
        String usernamename = (String) WebUtils.getSession().getAttribute("usernamename");
        String phone = (String) WebUtils.getSession().getAttribute("phone");
        Map aa=new HashMap();
        List<Dhl> data = dhService.getalldhl(usernamename);
        log.info("获取导航栏的数据成功");
        return data;
    }
}
